package top.arryweb.application.domain.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @Description 创建交易流水
 * @Author mac
 * @Date 2021/5/30
 **/

@ApiModel("DTO——创建交易流水")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Component
public class CreateTradeBlotterDTO {

  @ApiModelProperty("订单流水ID")
  @NotNull(message = "订单流水ID不能为空")
  private Long orderId;

  @ApiModelProperty("分账订单id，如果没有则不填")
  private Long distributionOrderId;

  @ApiModelProperty("商户id")
  private Long merchantId;

  @ApiModelProperty("用户id")
  @NotNull(message = "用户id不可为空")
  private Long userId;

  @ApiModelProperty("金额")
  private BigDecimal amount;

  @ApiModelProperty("收益记录类型id")
  private Long capitalDailyTypeId;

  @ApiModelProperty(value = "支付类型(1支付，2退款)",allowableValues = "size[1,2]" )
  @Size(min = 1,max = 2)
  private Integer payType;

  public CreateTradeBlotterDTO setOrderId(Long orderId) {
    this.orderId = orderId;
    return this;
  }

  public CreateTradeBlotterDTO setDistributionOrderId(Long distributionOrderId) {
    this.distributionOrderId = distributionOrderId;
    return this;
  }

  public CreateTradeBlotterDTO setMerchantId(Long merchantId) {
    this.merchantId = merchantId;
    return this;
  }

  public CreateTradeBlotterDTO setUserId(Long userId) {
    this.userId = userId;
    return this;
  }

  public CreateTradeBlotterDTO setAmount(BigDecimal amount) {
    this.amount = amount;
    return this;
  }

  public CreateTradeBlotterDTO setCapitalDailyTypeId(Long capitalDailyTypeId) {
    this.capitalDailyTypeId = capitalDailyTypeId;
    return this;
  }

  public CreateTradeBlotterDTO setPayType(Integer payType) {
    this.payType = payType;
    return this;
  }
}

/**
 * SpringBoot参数校验的方法总结 https://www.yht7.com/news/145313
 */
